<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<import type="css" file="css.global" />
<import type="css" file="css.form" />
<import type="js" file="js.jquery" />
<import type="js" file="js.jquery#form" />
</head>
<body>
<div class="search">
<form action="" method="post" name="form1" id="form1" onsubmit="return checkform()">
<b>新建文件夹：</b><input type="text" name="name" >
<input type="hidden" name="tpl" value="{$type}">
<input type="submit" value="创建" title="创建新文件夹" class="submit">
</form>
</div>
<div class="list">
<volist name="data" id="vo" empty="$empty">
	<div class="folder"><span class="ico"></span><span class="foldername" onclick="lists({$vo.id})">{$vo.name}</span><span style="float: right;padding-right:20px;" class="stripe"><a href="javascript:void(0);" onclick="del({$vo.id});">删除</a></span></div>
</volist>
</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
	$(".submit").click(function(){
		var name = $("input[name='name']").val();
		var tpl = $("input[name='tpl']").val();
		$.post("__URL__/add",{name:name,tpl:tpl},function(){
			location.reload();
		});
	});
});
function lists(id){
	window.location="__APP__/Database/upload_list?id="+id+"&type=2";
}
function del(id){
	if(confirm("确定删除该文件夹？删除之后该文件夹下面的文件也将同时被删除，请谨慎操作！")){
		$.get("__APP__/Database/folderdel?id="+id+"&type=2",function(result){
			location.reload();
		});
	}else{
		return false;
	}
}
function checkform(){
	var name = $("input[name='name']").val();
	if(name == ''){
		alert("请填写文件夹名称");return false;
	}
}
</script>
</html>